/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 adv_actor_model.h

	$Header: /heroes4/adv_actor_model.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ADV_ACTOR_MODEL_H_INCLUDED )
#define ADV_ACTOR_MODEL_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "actor_model.h"
#include "actor_sequence.h"
#include "adv_actor_model_definition.h"
#include "cached_ptr.h"
#include "footprint.h"

// ------------------------------------------------------------------------------
// t_adv_actor_model class
// ------------------------------------------------------------------------------

class t_adv_actor_model
	:	public t_actor_model< t_adv_actor_model_definition >,
		public t_footprint
{
public:
	// Types
	typedef t_adv_actor_action_id			t_action_id;
	typedef t_adv_actor_model_definition	t_definition;

	// Constructors/Destructor
	t_adv_actor_model( t_adv_actor_model const & other );
	explicit t_adv_actor_model( t_cached_ptr< t_definition > definition_ptr );
	virtual ~t_adv_actor_model();

	// Member functions
	virtual bool			are_any_cells_flat() const;
	virtual bool			are_any_cells_impassable() const;
	t_screen_point const &	get_flag_offset() const;
	virtual t_map_point_2d	get_size() const;
	virtual bool			is_cell_flat( t_map_point_2d const & point ) const;
	virtual bool			is_cell_impassable( t_map_point_2d const & point ) const;
	virtual bool			is_left_edge_trigger( t_map_point_2d const & point ) const;
	virtual bool			is_right_edge_trigger( t_map_point_2d const & point ) const;
	virtual bool			is_trigger_cell( t_map_point_2d const& point ) const;

	// Operators
	t_adv_actor_model & operator=( t_adv_actor_model const & other );

protected:
		// Types
	struct t_sequence_info
	{
		// Data members
		bool					loaded;
		t_actor_sequence_ptr	ptr;

		// Constructor
		t_sequence_info() : loaded( false ) {}
	};

	virtual t_actor_sequence_cache get_cache( std::string const&	 name,
										      t_screen_point const& offset ) const;
	virtual t_actor_sequence_ptr   get_sequence_ptr( t_action_id action_id, 
												     t_direction direction ) const;

	mutable t_sequence_info	m_sequence_info_array_array[ k_action_count ][ k_direction_count ];
};

// ------------------------------------------------------------------------------
// t_adv_actor_model inline members
// ------------------------------------------------------------------------------

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
inline t_screen_point const & t_adv_actor_model::get_flag_offset() const
{
	return get_definition().get_flag_offset();
}

#endif // !defined( ADV_ACTOR_MODEL_H_INCLUDED )
